<?php

namespace app\common\model;

use think\Model;
use think\Db;

class Role extends Model {

    protected function initialize() {
        parent::initialize();
    }

    /* 注册 钩子函数 */
    protected static function init() {
        self::event('after_insert', function(&$data) {
            $data = $data->toArray();
            self::_insetOrUpdate($data, 1);
        });

        self::event('after_update', function(&$data) {
            $data = $data->toArray();
            self::_insetOrUpdate($data, 2);
        });
    }

    //新增或修改关联数据  1表新增  2表修改
    protected static function _insetOrUpdate(&$data, $type) {
        $labels = input('post.labels/a');

        
    }

    

}
